class Solution {
public:
    int divide(int dividend, int divisor) {
        long long a = dividend, b = divisor;
        long long res = a / b;
        if (res > 2147483647)
        {
            res = 2147483647;
        }
        else if (res < -2147483647 - 1)
        {
            res = -2147483647-1;
        }
        return res;
    }
};
